package org.neuedu.ssmp.crm.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.*;
import org.neuedu.ssmp.crm.entity.Chances;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author MoonHolder
 * @since 2019-12-09
 */
public interface ChancesMapper extends BaseMapper<Chances> {
    @Select("select * from orders s join chances a on a.id = s.customer_id where a.id=#{id}")
    Chances lists(Integer id);

    @Results({
            @Result(column = "create_user_id",property = "createUserId"),
            @Result(column = "create_user_id",property = "createUserName",one = @One(select = "org.neuedu.ssmp.crm.mapper.ServeListMapper.findUserName"))
    })
    @Select("select id, name, manager_name, chances_from, phone, content, success_rate, chances_desc, create_user_id, username, create_time, chances_time, state, is_success from chances")
    List<Chances> page();

}
